package com.woniu.bh.config;

import io.swagger.models.Swagger;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

/**
 * @version: V1.0
 * @author: Xbao
 * @className: SwaggerConfig
 * @packageName: com.woniu.bh.config
 * @description:
 * @data: 2020-10-15 11:58
 */
@Component
@EnableConfigurationProperties()
public class SwaggerConfig implements SwaggerResourcesProvider {

    @Override
    public List<SwaggerResource> get() {
        return Arrays.asList(
                getSr("customer-server","1.0","/customer/v2/api-docs"),
                getSr("backstage-server","1.0","/back/v2/api-docs"),
                getSr("beautysalon-server","1.0","/beautysalon/v2/api-docs")
        );
    }

    private SwaggerResource getSr(String name,String version,String url){
        SwaggerResource sr = new SwaggerResource();
        sr.setName(name);
        sr.setSwaggerVersion(version);
        sr.setUrl(url);
        return sr;
    }
}
